Employment Situation

Notes (2 November 2018):

  1. There is no real earnings data because the CPI update is out of sync. This can be fixed at a later date.
  2. Something wrong with hours worked??
In [1]:
%%html
<link rel="stylesheet" href="./static/style.css">
In [1]:
# Environment Defn.
import sys
import os

# Add the parent folder to path
sys.path.append(os.path.split(os.getcwd())[0])

# %load_ext autoreload
# %autoreload 2

# Regular module imports
import pandas as pd
import numpy as np
import sqlite3
from datetime import datetime

from IPython.display import HTML
from ipywidgets import Layout
import ipywidgets as widgets

from bokeh.plotting import show
from bokeh.io import output_notebook

# Own
from src.widgets import EmploymentDashboard

output_notebook(hide_banner=True)

dashboard = EmploymentDashboard('../data/employment_dashboard.db', load_data={'which': ['cpi', 'cps', 'ces'], 'verbose': True})
C:\Users\us57144\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed.  If the frontend dies,
                the kernel may be left running.  Please let us know
                about your system (bitness, Python, etc.) at
                ipython-dev@scipy.org
  ipython-dev@scipy.org""")
Reloading Data
CPS:  (1/3) Metadata | (2/3) Series | (3/3) Data | DONE (165.56 s.)
CES:  (1/3) Metadata | (2/3) Series | (3/3) Data | DONE (159.68 s.)
Data last updated: 2019-02-01 07:41:22.122890

Summary

In [2]:
show(dashboard.summary())

Employment

In [3]:
show(dashboard.employment())

Unemployment

In [4]:
show(dashboard.unemployment())

Labor Force Participation

In [5]:
show(dashboard.participation())

Wages and Earnings

In [6]:
show(dashboard.wages())

Hours of Work

In [7]:
show(dashboard.hours())
avg ovt dMM abs production S
       date  value  sec seas  type         Sector  worker_group_code  \
530 2017-10    4.5   30    S     9  Manufacturing                  1   

    worker_group  is_private  emp_share sum_type hrs_type  
530   production           1    0.08519      avg      ovt  
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-7-3a573ce9d75f> in <module>()
----> 1 show(dashboard.hours())

~\Dropbox\grantThornton\projects\employment_dashboard\src\widgets.py in hours(self)
    155 
    156   def hours(self):
--> 157     by_industry = HoursByIndustryTables(self.conn)()
    158 
    159     notes = Div(

~\Dropbox\grantThornton\projects\employment_dashboard\src\by_industry.py in __call__(self, force)
     63 
     64   def __call__(self, force: bool = False):
---> 65     if not self._tbls or force: self.construct_tables()
     66     if not self.widget or force: self.construct_widget()
     67 

~\Dropbox\grantThornton\projects\employment_dashboard\src\by_industry.py in construct_tables(self)
    386                   print(su, hrs, trans, wgt, wkg, seas)
    387                   print(dd.head(1))
--> 388                   raise e
    389 
    390   def _get_caption(self, su, hrs, wkg, trans, wgt, seas):

~\Dropbox\grantThornton\projects\employment_dashboard\src\by_industry.py in construct_tables(self)
    381                               seas)] = self._construct_one_table(
    382                                 dd, trans, wgt, wkg, seas, caption,
--> 383                                 stat_fmt
    384                               )
    385                 except Exception as e:

~\Dropbox\grantThornton\projects\employment_dashboard\src\by_industry.py in _construct_one_table(self, dd, trans, wgt, wkg, seas, caption, stat_fmt)
    177     # Apply styles
    178     cmap = utils.get_pos_neg_colormap(
--> 179       dd.values[:, :-1], attr='background-color'
    180     )
    181 

~\Dropbox\grantThornton\projects\employment_dashboard\src\utils.py in get_pos_neg_colormap(v, n_colors, attr)
     41   mx = abs(v).max()
     42   if v.max() == mx:
---> 43     p_cuts = np.percentile(v[v > 0], np.linspace(0, 100, n_colors))
     44     n_cuts = -np.flip(p_cuts)
     45   else:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\lib\function_base.py in percentile(a, q, axis, out, overwrite_input, interpolation, keepdims)
   3538         raise ValueError("Percentiles must be in the range [0, 100]")
   3539     return _quantile_unchecked(
-> 3540         a, q, axis, out, overwrite_input, interpolation, keepdims)
   3541 
   3542 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\lib\function_base.py in _quantile_unchecked(a, q, axis, out, overwrite_input, interpolation, keepdims)
   3650     r, k = _ureduce(a, func=_quantile_ureduce_func, q=q, axis=axis, out=out,
   3651                     overwrite_input=overwrite_input,
-> 3652                     interpolation=interpolation)
   3653     if keepdims:
   3654         return r.reshape(q.shape + k)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\lib\function_base.py in _ureduce(a, func, **kwargs)
   3248         keepdim = (1,) * a.ndim
   3249 
-> 3250     r = func(a, **kwargs)
   3251     return r, keepdim
   3252 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\lib\function_base.py in _quantile_ureduce_func(a, q, axis, out, overwrite_input, interpolation, keepdims)
   3765             n = np.isnan(ap[-1:, ...])
   3766 
-> 3767         x1 = take(ap, indices_below, axis=axis) * weights_below
   3768         x2 = take(ap, indices_above, axis=axis) * weights_above
   3769 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\fromnumeric.py in take(a, indices, axis, out, mode)
    179            [5, 7]])
    180     """
--> 181     return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
    182 
    183 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
     49 def _wrapfunc(obj, method, *args, **kwds):
     50     try:
---> 51         return getattr(obj, method)(*args, **kwds)
     52 
     53     # An AttributeError occurs if the object does not have

IndexError: cannot do a non-empty take from an empty axes.